package main

import (
	"fmt"
	"os"
	"time"
)

func main() {

	pid := 0
	var pr, pw *os.File
	go func() {
		pr, pw, _ = os.Pipe()
		fmt.Println(pr)
		fmt.Println(pw)
		i := 0
		for i < 10 {
			fmt.Printf("#%03d$ticking ....\n", i)
			i++
			time.Sleep(5 * time.Second)
		}
	}()
	fmt.Println(os.Getpid())
	var input string
	n, err := fmt.Fscan(os.Stdin, &input)
	if err != nil {
		panic(err)
	}

	fmt.Println(n)
	if input == "kill" {
		fmt.Println(pid)
		pr.Close()
		pw.Close()
	}

	time.Sleep(time.Hour)
}
